home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / GB-PVR 1.2.13 / GBPVR10213.msi / Cabs.w1.cab / Ajax_Calls2.cs34 < prev    next >
Text File  |  2008-02-23  |  4KB  |  102 lines

  1. using System;
  2. using System.Collections;
  3. using System.Diagnostics;
  4. using System.Web.Script.Services;
  5. using System.Web.Services;
  6. using GBPVR.Public;
  7. using GBPVRSchedule;
  8.  
  9. /// <summary>
  10. /// Summary description for Ajax_Calls2
  11. /// </summary>
  12. /// 
  13.  
  14. namespace gbweb.classes
  15. {
  16.     //[WebService(Namespace = "http://gbpvr.com/ewa/services")]
  17.     //[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  18.     //[ToolboxItem(false)]
  19.     [ScriptService]
  20.     public class Ajax_Calls2 : WebService
  21.     {
  22.         [WebMethod]
  23.         public string GetServerTime()
  24.         {
  25.             return DateTime.Now.ToLongTimeString().Trim();
  26.         }
  27.  
  28.         [WebMethod]
  29.         public string GetReminders()
  30.         {
  31.  
  32.             Settings guideParams = Global.Settings;
  33.             Schedule scheduleHelper = Global.Schedule;
  34.             ArrayList reminders = scheduleHelper.GetReminderList();
  35.             string temptitle = string.Empty;
  36.             string returnReminders = string.Empty;
  37.             string onclick = string.Empty;
  38.             string href = string.Empty;
  39.             foreach (Programme reminder in reminders)
  40.             {
  41.                 TimeSpan span = reminder.getStartTime() - DateTime.Now;
  42.                 int minutes = span.Minutes;
  43.                 if (span.Days > 0)
  44.                 {
  45.                     minutes = minutes + ((span.Days * 24) * 60);
  46.                 }
  47.                 if (span.Hours > 0)
  48.                 {
  49.                     minutes = minutes + (span.Hours * 60);
  50.                 }
  51.                 if ((minutes <= Convert.ToInt32(guideParams.reminder) && minutes > 0) || (minutes == 0 && span.Seconds < -30))
  52.                 {
  53.                     href = "Details2.aspx?id=" + reminder.getOID();
  54.                     ScheduledRecording checkSchedule = scheduleHelper.GetScheduledRecordingByOID(reminder.getOID());
  55.                     if (checkSchedule != null)
  56.                     {
  57.                         href += "&rid=" + reminder.getOID();
  58.                     }
  59.                     onclick = " onclick=\"EditPop5(this.href,'Add2');return false;\"";
  60.                     temptitle += "<span class=\"timeHighlight\">" + reminder.getStartTime().ToShortDateString() + " " + reminder.getStartTime().ToShortTimeString() + "</span> " +
  61.                             reminder.getTitle();
  62.                     temptitle = "<a href=\"" + href + "\"" + onclick + ">" + temptitle + "</a><br>";
  63.                     returnReminders += temptitle;
  64.                     temptitle = string.Empty;
  65.                 }
  66.             }
  67.             if (returnReminders != string.Empty)
  68.             {
  69.                 reminders.Clear();
  70.                 reminders.TrimToSize();
  71.                 return returnReminders;
  72.             }
  73.             else
  74.             {
  75.                 reminders.Clear();
  76.                 reminders.TrimToSize();
  77.                 return "";
  78.             }
  79.         }
  80.  
  81.         [WebMethod]
  82.         public string GetStreamerStatus()
  83.         {
  84.             string streamActive = "";
  85.             //Check processes running on the seerver.  If VLC is running assuming streaming is active
  86.             try
  87.             {
  88.                 foreach (Process thisproc in Process.GetProcessesByName("vlc"))
  89.                 {
  90.                     streamActive = "true";
  91.                     continue;
  92.                 }
  93.             }
  94.             catch (Exception Exc)
  95.             {
  96.             }
  97.  
  98.             return streamActive;
  99.         }
  100.     }
  101. }
  102.